const path = require('path');

module.exports = {
    // 入口
    entry: './src/index.ts',
    // loader
    module: {
        rules: [
            {test: /\.tsx?$/, use: 'ts-loader', exclude: /node_modules/,},
            //加载CSS文件
            {test: /\.css$/i, use: ['style-loader', 'css-loader'],},
            //加载图片
            {test: /\.(png|svg|jpg|jpeg|gif)$/i, type: 'asset/resource',},
            //加载字体
            {test: /\.(woff|woff2|eot|ttf|otf)$/i, type: 'asset/resource',},
        ],
    },
    resolve: {
        extensions: ['.tsx', '.ts', '.js'],
    },
    // 出口
    output: {
        filename: '[name].js',
        path: path.resolve(__dirname, 'dist'),
    },
};
